import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import http from '@/libs/http'
import { isAuth } from '@/libs/auth'
import { ResultMessage } from "@/libs/response"
import * as filters from '@/libs/filters'
import PubSub from 'pubsub-js'
import BaiduMap from 'vue-baidu-map'
import { baseApi, baseImageUrl } from '@/config'

// flexible会为页面根据屏幕自动添加标签，动态控制initial-scale，maximum-scale，minimum-scale等属性的值 ===>设备缩放比
import 'lib-flexible'

// 轮播组件
import VueAwesomeSwiper from 'vue-awesome-swiper'

// 动画样式库
import animated from 'animate.css';
// 页面滚动到可视区域执行动画 wow.js
import { WOW } from 'wowjs'

import '@wangeditor/editor/dist/css/style.css'

import '@/assets/styles/index.scss'
import '@/assets/styles/site.scss'

import Screenfull from "screenfull";
import VueI18n from 'vue-i18n'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'

import '@/assets/iconfont/iconfont.css'
import '@/assets/styles/fonts.scss'

// Element UI i18n 国际化
import enLocale from 'element-ui/lib/locale/lang/en'
import zhLocale from 'element-ui/lib/locale/lang/zh-CN'
import en from '@/i18n/en'
import jp from '@/i18n/jp'
import zh from '@/i18n/zh'

// 西瓜播放器样式
import 'xgplayer/dist/index.min.css';


// 注册全局过滤器
Object.keys(filters).forEach(key => {
    Vue.filter(key, filters[key])
})

// 国际化
Vue.use(VueI18n)
const i18n = new VueI18n({
    locale: 'zh',
    messages: {
        en: Object.assign(en, enLocale),
        jp: Object.assign(jp, zhLocale),
        zh: Object.assign(zh, zhLocale)
    },
})
Vue.use(ElementUI, {
    i18n: (key, value) => i18n.t(key, value)
})

Vue.use(ElementUI)

Vue.use(BaiduMap, {
    // ak 是在百度地图开发者平台申请的密钥 详见 http://lbsyun.baidu.com/apiconsole/key */
    ak: '1f648c12a2709a14b0e79551fdc5f791'
})

// 轮播组件
Vue.use(VueAwesomeSwiper)

// 动画
Vue.use(animated);
Vue.prototype.$wow = new WOW({
    boxClass: 'wow', // default
    animateClass: 'animated', // default
    offset: 50, // default
    mobile: true, // default
    live: false,
    // live为true时，控制台会提示：MutationObserver is not supported by your browser. & WOW.js cannot detect dom mutations, please call .sync() after loading new content.
    callback: function (box) {
        console.log("WOW: animating <" + box.tagName.toLowerCase() + ">")
    }
});

/**
 * 全局属性
 */
Vue.prototype.$Screenfull = Screenfull
Vue.prototype.$baseApi = baseApi
Vue.prototype.$baseImageUrl = baseImageUrl
Vue.prototype.$http = http
Vue.prototype.isAuth = isAuth
Vue.prototype.ResultMessage = ResultMessage
Vue.prototype.$echarts = window.echarts
Vue.prototype.PubSub = PubSub

Vue.config.productionTip = false
new Vue({
    router,
    store,
    i18n,
    render: h => h(App)
}).$mount('#app')
